#include <stdio.h>

void fun(int test[], int len, int key);

int main() {
	int len = 0;
	scanf("%d", &len);
	int test[len];
	for (int i = 0; i < len; i++) {
		scanf("%d", &test[i]);
	}

	int key = 0;
	scanf("%d", &key);
	fun(test,  len, key);

	return 0;
}

void fun(int test[], int len, int key) {
	int p1 = 0, p2 = 0;

	while (p2 < len) {
		if (test[p2] == key) {
			p2++;
		} else {
			test[p1] = test[p2];
			p1++;
			p2++;
		}
	}

	for (int i = 0; i < p1; i++) {
		printf("%d ", test[i]);
	}
}